package sheshen.come.cn.sheshen.feature.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.util.Log;

import java.util.List;

import sheshen.come.cn.sheshen.feature.FeaturesFragment;
import sheshen.come.cn.sheshen.feature.ui.FromeIdFragment;
import sheshen.come.cn.sheshen.text.TextFragment;


/**
 * Created by admin on 2016/8/1.
 */
public class GatherAdapter extends FragmentStatePagerAdapter {
    public static final String TAB_TAG = "@dream@";
    private List<String> mTitles;
    public GatherAdapter(FragmentManager fm, List<String> titles) {
        super(fm);
        this.mTitles = titles;
    }

    private Fragment fragment;
    @Override
    public Fragment getItem(int position) {
        if(position==0){
            fragment = new FromeIdFragment();
        }
        if (position ==1){
            fragment = new FeaturesFragment();
        }
        if (position==2){
            fragment = new TextFragment();
        }

        return fragment;
    }

    @Override
    public int getCount() {
        return mTitles.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return mTitles.get(position).split(TAB_TAG)[0];
    }

    @Override
    public int getItemPosition(Object object) {
        return getItemPosition(object);
    }

}
